package linear_list.leetcode.easy;

/**
 * @author Stark
 * @description 链表的中间结点
 * 题目链接：https://leetcode-cn.com/problems/middle-of-the-linked-list
 * @date 2022/4/11 19:42
 **/
public class Num876_MiddleNode {
    public ListNode middleNode(ListNode head) {
        if(head.next == null)
            return head;
        ListNode slow = head,fast = head;
        while(fast != null && fast.next != null){
            slow = slow.next;
            fast = fast.next.next;
        }
        return slow;
    }
}
